load("@rules_rust//rust:defs.bzl", "rust_doc_test", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
    # Keep sorted.
    "//rs/monitoring/adapter_metrics/client",
    "//rs/monitoring/logger",
    "@crate_index//:futures",
    "@crate_index//:libc",
    "@crate_index//:parking_lot",
    "@crate_index//:prometheus",
    "@crate_index//:slog",
    "@crate_index//:tokio",
    "@crate_index//:tokio-metrics",
] + select({
    "@rules_rust//rust/platform:linux": [
        "@crate_index//:procfs",
    ],
    "//conditions:default": [],
})

MACRO_DEPENDENCIES = []

DEV_DEPENDENCIES = []

MACRO_DEV_DEPENDENCIES = []

ALIASES = {}

rust_library(
    name = "metrics",
    srcs = glob(["src/**"]),
    aliases = ALIASES,
    crate_name = "ic_metrics",
    proc_macro_deps = MACRO_DEPENDENCIES,
    version = "0.9.0",
    deps = DEPENDENCIES,
)

rust_test(
    name = "metrics_test",
    aliases = ALIASES,
    crate = ":metrics",
    proc_macro_deps = MACRO_DEPENDENCIES + MACRO_DEV_DEPENDENCIES,
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_doc_test(
    name = "metrics_doc_test",
    crate = ":metrics",
)
